--[[
Name: AceEvent-2.0-compat

This will be an emulation of AceEvents-2.0 is a fork that uses LibSignal as the back bone.
]]

return

local MAJOR_VERSION, MINOR_VERSION = "AceEvent-2.0", 1000000+tonumber("$Revision $":match("(%d+)"))
local LibSignal = LibStub:GetLibrary("LibSignal-1.0")

if not AceLibrary then error("AceEvent-2.0-compat requires AceLibrary") end
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
-- Need to check if there already is an AceEvents-2.0 load we can not replace it!
-- This is just an experiment
local AceOO = AceLibrary:GetInstance("AceOO-2.0")
if not AceOO then error("AceEvent-2.0-compat requires AceOO-2.0")

local AceEvent = AceOO.Mixin {
   -- FireSignal
   "TriggerEvent",

   -- RegisterSignalListener
   "RegisterEvent",
   "RegisterAllEvents",

   -- UnregisterSignalListener
   "UnregisterEvent",
   -- UnregisterSignalHandle
   "UnregisterAllEvents",

   "IsEventRegistered",

   -- Combat events
   "ScheduleLeaveCombatAction",
   "CancelAllCombatSchedules",

   -- Bucket events what to do with these
   "RegisterBucketEvent",
   "UnregisterBucketEvent",
   "UnregisterAllBucketEvents",
   "IsBucketEventRegistered",

   -- LibSignal has no timing need to implement raw
   "ScheduleEvent",
   "ScheduleRepeatingEvent",
   "CancelScheduledEvent",
   "CancelAllScheduledEvents",
   "IsEventScheduled",
}

-- 
local function upgrade(...)
end

AceLibrary:Register(AceEvent, MAJOR_VERSION,MINOR_VERSION, upgrade)
